import req from '@/utils/request'
import type { TrademarkData, Data } from './model/TrademarkType'

enum Api {
  getTrademarkApi = '/admin/product/baseTrademark',
  addTrademarkApi = '/admin/product/baseTrademark/save',
  delTrademarkApi = '/admin/product/baseTrademark/remove',
  editTrademarkApi = '/admin/product/baseTrademark/update',
}

// 请求品牌数据的接口
export function getTrademarkList(page: number, limit: number) {
  return req.get<unknown, TrademarkData>(
    Api.getTrademarkApi + `/${page}/${limit}`
  )
}

// 添加品牌信息的接口

export function addTrademarkApi(data: Data) {
  return req.post<unknown, null>(Api.addTrademarkApi, data)
}

// 删除品牌信息的接口
export function delTrademarkApi(id: number) {
  return req.delete<unknown, null>(Api.delTrademarkApi + `/${id}`)
}

// 编辑品牌数据的接口
export function editTrademarkApi(data: Data) {
  console.log('开始修改', data)
  return req.put<unknown, null>(Api.editTrademarkApi, data)
}
